const MyEmitter = require("events")

const myEmitter = new MyEmitter()

//事件绑定监听器
myEmitter.on("event_name", (a, b) => {
    console.log(a, b, this, this === myEmitter)
    console.log("有内容")
})


//事件发射器
myEmitter.emit("event_name", "a", "b")


const myEmitter2 = new MyEmitter()
myEmitter2.on("event_name1", function (a, b) {
    console.log(a, b, this)
})

myEmitter2.emit("event_name1")